import { lazy } from "react";
import { Navigate } from "react-router-dom";

// 一级路由
const Layout = lazy(() => import('../pages/Layout/Layout'))
const Management = lazy(() => import('../pages/Management/Management')) //果币充值
const Enterprise = lazy(() => import('../pages/Enterprise/Enterprise')) //企业服务
const Order = lazy(() => import('../pages/Order/Order')) //订单/发票
// 二级路由
const Create = lazy(() => import('../pages/Create/Create'))
const Al = lazy(() => import('../pages/Al/Al'))
const Draft = lazy(() => import('../pages/Draft/Draft'))
const AlDesign = lazy(() => import('../pages/AlDesign/AlDesign'));
const AlMatting = lazy(() => import('../pages/AlMatting/AlMatting'));
const ImageEdit = lazy(() => import('../pages/ImageEdit/ImageEdit'));
const Material = lazy(() => import('../pages/Material/Material'));
const MySpace = lazy(() => import('../pages/MySpace/MySpace'));
const Open = lazy(() => import('../pages/Open/Open'));
const Openlocal = lazy(() => import('../pages/OpenIocal/Openlocal'));
const Chat = lazy(() => import('../pages/Chat/Chat'));
const Design = lazy(() => import('../pages/AlDesign/AlDesign'));
const Painting = lazy(() => import('../pages/Painting/Painting'));
const Copywriting = lazy(() => import('../pages/Copywriting/Copywriting'));
const Workbenches = lazy(() => import('../pages/Workbenches/Workbenches')) //数据
const Template = lazy(() => import('../pages/Template/Template')) //模版管理

const VIP = lazy(() => import('../pages/Order/children/VIP/VIP')) //VIP订单
const Seat = lazy(() => import('../pages/Order/children/Seat')) //席位订单
const Printing = lazy(() => import('../pages/Order/children/Printing')) //印刷订单
const Corporate = lazy(() => import('../pages/Order/children/Corporate')) //对公转账
const Balance = lazy(() => import('../pages/Order/children/Balance')) //余额收支
const Apply = lazy(() => import('../pages/Order/children/Apply')) //申请发票
const Invoicing = lazy(() => import('../pages/Order/children/Invoicing')) //发票历史

const Account = lazy(() => import('../pages/Account/Account')) //果币充值-首页
const MaterialDownload = lazy(() => import('../pages/MaterialDownload/MaterialDownload')) //果币充值-果币充值
const Authorization = lazy(() => import('../pages/Authorization/Authorization')) //果币充值-财务
const DesignPage = lazy(() => import('../pages/DesignPage/DesignPage'));
//节日
const Year = lazy(() => import('../pages/Holidays/Year'))  // 南方小年
const International = lazy(() => import('../pages/Holidays/International')) //国际海关日
const Leprosy = lazy(() => import('../pages/Holidays/Leprosy'))  //麻风节
const Internationalholocaust = lazy(() => import('../pages/Holidays/Internationalholocaust')) //国际大屠杀纪念日
const Newyear = lazy(() => import('../pages/Holidays/Newyear')) //除夕
const Springfestival = lazy(() => import('../pages/Holidays/Springfestival')) //春节
const Hellofebruary = lazy(() => import('../pages/Holidays/Hellofebruary'))  //2月你好
const Welcome = lazy(() => import('../pages/Holidays/Welcome')) //迎财神
const Beginning = lazy(() => import('../pages/Holidays/Beginning')) //立春
const World = lazy(() => import('../pages/Holidays/World')) //世界抗癌日
const Good = lazy(() => import('../pages/Holidays/Good')) //开工大吉
const Meteorological = lazy(() => import('../pages/Holidays/Meteorological')) //国际气象节
const Lantern = lazy(() => import('../pages/Holidays/Lantern')) //元宵节
const Valentine = lazy(() => import('../pages/Holidays/Valentine')) //214情人节
const Rain = lazy(() => import('../pages/Holidays/Rain')) //雨水
const Fillpositions = lazy(() => import('../pages/Holidays/Fillpositions')) //填仓节

const Selected = lazy(() => import('../pages/Selected/Selected'))  //精选模版
const Creates = lazy(() => import('../pages/Creates/Creates'))
// 三级路由
const Myspace_myspace = lazy(() => import('../pages/Myspace_myspace/Myspace_myspace')) //我的空间
const RecycleBin = lazy(() => import('../pages/RecycleBin/RecycleBin'))  //回收站
const Favorites = lazy(() => import('../pages/Favorites/Favorites'))  //收藏夹
const Drafts = lazy(() => import('../pages/Drafts/Drafts')) //草稿箱
const Work = lazy(() => import('../pages/Work/Work'))  //作品数据
const Published = lazy(() => import('../pages/Published/Published')) //分发数据
// VIP中的三级路由
const All = lazy(() => import('../pages/Order/children/VIP/children/All')) //全部订单
const Payment = lazy(() => import('../pages/Order/children/VIP/children/Payment')) //待支付
const Completed = lazy(() => import('../pages/Order/children/VIP/children/Completed')) //已完成
// 四级路由
const Initiated = lazy(() => import('../pages/Initiated/Initiated')) //我发起的
const Participated = lazy(() => import('../pages/participated/Participated')) //我参与的
const children = [
    {
        path: '/layout/create',
        element: <Create />,
    },
    {
        path: '/layout/al',
        element: <Al />,
    },
    {
        path: '/layout/selected',
        element: <Selected />,
    },
    {
        path: '/layout/draft',
        element: <Draft />,
    },
    {
        path: '/layout/almatting',
        element: <AlMatting />,
        roles: 'admin'
    },
    // 模版管理
    {
        path: '/layout/template',
        element: <Template />
    },
    {
        path: '/layout/imageedit',
        element: <ImageEdit />,
        roles: 'admin'
    },
    {
        path: '/layout/material',
        element: <Material />,
    },
    {
        path: '/layout/myspace',
        element: <MySpace />,
        children: [
            {
                path: '/layout/myspace',
                element: <Navigate to='/layout/myspace/myspace_myspace'></Navigate>
            },
            {
                path: '/layout/myspace/myspace_myspace',
                element: <Myspace_myspace />,
                roles: 'user'
            },
            {
                path: '/layout/myspace/drafts',
                element: <Drafts />
            },
            {
                path: '/layout/myspace/favorites',
                element: <Favorites />
            },
            {
                path: '/layout/myspace/recycleBin',
                element: <RecycleBin />
            }
        ]
    },
    {
        path: '/layout/open',
        element: <Open />,
        roles: 'admin'
    },
    {
        path: '/layout/openlocal',
        element: <Openlocal />,
        roles: 'admin'
    },
    {
        path: '/aldesign/painting',
        element: <Painting />,
    },
    {
        path: '/aldesign/copywriting',
        element: <Copywriting />,
    },
    {
        path: '/Creates/Creates',
        element: <Creates />,
    },
    {
        path: '/layout/workbenches',
        element: <Workbenches />,
        children: [
            {
                path: '/layout/workbenches',
                element: <Navigate to='/layout/workbenches/work' />
            },
            {
                path: '/layout/workbenches/work',
                element: <Work />,
                roles: 'admin'
            },
            {
                path: '/layout/workbenches/published',
                element: <Published />,
                children: [
                    {
                        path: '/layout/workbenches/published',
                        element: <Navigate to='/layout/workbenches/published/participated' />
                    },
                    {
                        path: '/layout/workbenches/published/initiated',
                        element: <Initiated />
                    },
                    {
                        path: '/layout/workbenches/published/participated',
                        element: <Participated />
                    }
                ]
            }
        ]
    },
    {
        path: '/layout/year',
        element: <Year />
    },
    {
        path: '/layout/international',
        element: <International />
    },
    {
        path: '/layout/leprosy',
        element: <Leprosy />
    },
    {
        path: '/layout/internationalholocaust',
        element: <Internationalholocaust />
    },
    {
        path: '/layout/newyear',
        element: <Newyear />
    },
    {
        path: '/layout/springfestival',
        element: <Springfestival />
    },
    {
        path: '/layout/hellofebruary',
        element: <Hellofebruary />
    },
    {
        path: '/layout/welcome',
        element: <Welcome />
    },
    {
        path: '/layout/beginning',
        element: <Beginning />
    },
    {
        path: '/layout/world',
        element: <World />
    },
    {
        path: '/layout/good',
        element: <Good />
    },
    {
        path: '/layout/meteorological',
        element: <Meteorological />
    },
    {
        path: '/layout/lantern',
        element: <Lantern />
    },
    {
        path: '/layout/valentine',
        element: <Valentine />
    },
    {
        path: '/layout/rain',
        element: <Rain />
    },
    {
        path: '/layout/fillpositions',
        element: <Fillpositions />
    }
]
const router = [
    {
        path: '/aldesign',
        element: <AlDesign />,
        roles: 'admin',
        children: [
            {
                path: '/aldesign/design',
                element: <Design />,
            },
            {
                path: '/aldesign/painting',
                element: <Painting />,
            },
            {
                path: '/aldesign/copywriting',
                element: <Copywriting />,
            },
        ]
    },
    {
        path: '/',
        element: <Layout />,
        children: children
    },
    {
        path: '/Chat',
        element: <Chat />,
    },
    // 果币充值
    {
        path: '/management',
        element: <Management />,
        children: [
            {
                path: '/management',
                element: <Navigate to='/management/account' />
            },
            {
                path: '/management/account',
                element: <Account />
            },
            {
                path: '/management/authorization',
                element: <Authorization />
            },
            {
                path: '/management/materialDownload',
                element: <MaterialDownload />
            }
        ]
    },
    {
        path: '/enterprise',
        element: <Enterprise />,

    },
    {
        path: '/DesignPage',
        element: <DesignPage />
    },
    // 订单列表展示、全部、待付款、已完成tabs状态切换
    {
        path: '/order',
        element: <Order />,
        children: [
            {
                path: '/order',
                element: <Navigate to='/order/vip' />
            },
            {
                path: '/order/vip',
                element: <VIP />,
                children: [
                    {
                        path: '/order/vip',
                        element: <Navigate to='/order/vip/all' />
                    },
                    {
                        path: '/order/vip/all',
                        element: <All />
                    },
                    {
                        path: '/order/vip/Payment',
                        element: <Payment />
                    },
                    {
                        path: '/order/vip/Completed',
                        element: <Completed />
                    }
                ]
            },
            {
                path: '/order/seat',
                element: <Seat />
            },
            {
                path: '/order/printing',
                element: <Printing />
            },
            {
                path: '/order/corporate',
                element: <Corporate />
            },
            {
                path: '/order/balance',
                element: <Balance />
            },
            {
                path: '/order/apply',
                element: <Apply />
            },
            {
                path: '/order/invoicing',
                element: <Invoicing />
            },

        ]
    }

]
export default router